<?php

	header('Access-Control-Allow-Origin: *');
	header("Access-Control-Allow-Method:POST,GET");  
	header ( "Content-Type: text/html; charset=UTF-8" );
	require_once './mysql.class.php';
	require_once './response.class.php';
	//获取参数
	$rawPostData = file_get_contents("php://input");
	$postData = json_decode($rawPostData,true);
	//$YMDTime = date ( "Y-m-d" ); 
	//$YMDTime_de = date ( "Y-m-d", strtotime("-2 day"));
	//$start = 0;
	//$YMDTime = $postData['time'];
	$page = $postData['page'];
	$start = $page * 10;
	
	//实例化
	$sqlhelper = new sqlhelper();
	$re = new Response();
	
	//查询数据库对应的条数
	$sql = "select content,createtime,sex from blxbconfession_content where  state = 1 order by id desc limit $start,10";
	if ($sqlhelper->getResultNum($sql) == 0) {
		$message = array(
			'content' => "NULL",
		);
		$re->show(200,'fail',$message);
		exit();
	}
	$arr = $sqlhelper->fetchall($sql);
	$sqlhelper->close_connect();

	//返回json数据
	$message = array(
		'message' => $arr,
	);
	$re->show(200,'success',$message);
	exit();
